package com.gujiangbo.mapstruct;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

public class MapStructClientMain {

    public static void main(String[] args) {

        Student zhangSan = Student.builder().name("张三")
                .birthday(new Date())
                .age(34)
                .gender(GenderEnum.Female)
                .height(178.4).build();
        System.out.println(zhangSan);
       /* StudentVO zs = StudentMapper.INSTANCE.student2StudentVO(zhangSan);
        System.out.println(zs);
        StudentVO zs2 = StudentMapper.INSTANCE.student2StudentVoIgnoreHeight(zhangSan);
        System.out.println(zs2);*/

        Student student = Student.builder().name("小明").age(6).gender(GenderEnum.Male).height(121.1).birthday(new Date()).build();

        List<Student> list = new ArrayList<>();
        list.add(student);
        List<StudentVO> result = StudentMapper.INSTANCE.students2StudentVOs(list);
        System.out.println(result);


        // 多对象转换到一个对象
        Student xiaoming = Student.builder().name("小明").age(6).gender(GenderEnum.Male).height(121.1).birthday(new Date()).build();
        Course course = Course.builder().id(1L).courseName("语文").build();

        StudentVO2 studentVO2 = StudentMapper.INSTANCE.studentAndCourse2StudentVO(xiaoming, course);
        System.out.println(studentVO2);


    }
}
